package com.xja.contorller;

import com.xja.entity.House;
import com.xja.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("house")
public class HouserController {
    @Autowired
    private HouseService houseService;
    @RequestMapping("findhouse")
    private String findhouse(Model model){
        Map<String,Object> hashMap=new HashMap<String, Object>();
        List<House> houseList =houseService.findHouseByPage(hashMap);
        model.addAttribute("houseList",houseList);
        return "page/houselist";
    }
   //detail.jsp
    @RequestMapping("getone")
    public String getone(Integer id, ModelMap map){
        map.put("list",houseService.getOne(id));

        return "page/detail";
    }
}
